package com.example.init.controller.HTTPController;

import jakarta.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/header")
public class HeaderController {

    @RequestMapping("/header1")
    public String getHeader(HttpServletRequest request){
        String userAgent = request.getHeader("Cookie");
        return "Cookie: " + userAgent;
    }

    @RequestMapping("/header2")
    public String getHeader(@RequestHeader("User-Agent") String userAgent){
        return "userAgent:" +userAgent;
    }
}
